home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / DOpus511 / dopus_pch.lha / ARexx.lha / Arexx / PlayMod_MP.dopus5 < prev    next >
Text File  |  1995-05-13  |  5KB  |  130 lines

  1. /* Mod-Player v1.00 [13-May-1995] for Directory Opus 5.
  2.    By Leo Davidson ("Nudel", P0T-NOoDLE/Gods'Gift Utilities)
  3.  
  4.    This version is for use with MultiPlayer by Bryan Ford, but should be
  5.    easy to adapt to any other player with an ARexx port, such as
  6.    Eagle/DeliTracker, DMP, etc.
  7.    (In fact, a DeliTracker version should come with this script!).
  8.  
  9.    If you include the path of a module on the command line, using {f}, only
  10.    this mod will be played. If you omit the {f}, the program will play each
  11.    selected file in the first SOURCE lister, giving you a requester to go to
  12.    the next file or stop playing.
  13.  
  14.    If the player's ARexx port is not found, the program will be run for
  15.    you (you should edit the path below). This means the script may fail if
  16.    you disable the player's ARexx port, or give an incorrect command line
  17.    to it.
  18.    If the player's ARexx port takes over a minute to appear, an error
  19.    requester will appear on the DOpus screen and the script will quit.
  20.    REMEMBER to add the "RUN" command to the player command line if it does
  21.    not automatically detach from the shell (MultiPlayer does)!
  22.  
  23.    If the player was running to start with, or the user selects
  24.    "Leave Playing", the module will continue playing when the script finishes.
  25.    Otherwise, the player will be quit.
  26.  
  27. Call as:
  28. ------------------------------------------------------------------------------
  29. ARexx    DOpus5:ARexx/PlayMod_MP.dopus5 {Qp} [{f}]
  30. ------------------------------------------------------------------------------
  31. Turn off all switches.
  32. */
  33. /*- Path to MultiPlayer command --------------------------------------------*/
  34. MultiPlayer = "DH0:Tools/Music/MultiPlayer"
  35. /*--------------------------------------------------------------------------*/
  36. options results
  37. options failat 99
  38. signal on syntax;signal on ioerr        /* Error trapping */
  39. parse arg DOpusPort FilePath
  40. DOpusPort = Strip(Strip(DOpusPort,"B"," "),"B",'"')
  41. FilePath = Strip(Strip(FilePath,"B"," "),"B",'"')
  42. If DOpusPort~="" THEN Address value DOpusPort
  43. ELSE Do
  44.     Say "Not correctly called from Directory Opus 5!"
  45.     Say "Load this ARexx script into editor for more info."
  46.     EXIT
  47.     END
  48.  
  49. Quit_After = "NO"
  50. If ~ShowList("P","RXTRACKER") Then Do
  51.     Address Command MultiPlayer
  52.     Quit_After = "YES"
  53.     TickTick = Time(M)
  54.     Do While ~ShowList("P","RXTRACKER")
  55.         IF Time(M) - TickTick > 0 Then Do
  56.             dopus request '"Error loading MultiPlayer!'||X2C(0A)||'Check its command-line in the ARexx script itself." OK'
  57.             EXIT
  58.             END
  59.         END
  60.     END
  61.  
  62. /* If file-path was specified on command line, just play that mod, else
  63.    go through all the selected ones. */
  64.  
  65. If FilePath = "" Then Do
  66.     lister query source                /* Get lister and set busy */
  67.     IF RC ~= 0 Then Do
  68.         dopus request '"You must have a SOURCE lister!" OK'
  69.         Call END_PART
  70.         End
  71.     Lister_Handle = RESULT
  72.     lister set Lister_Handle busy 1
  73.  
  74.     lister query Lister_Handle numselentries    /* Get info about selected */
  75.     Lister_NumSelEnt = RESULT            /* entries & path to them */
  76.     lister query Lister_Handle path
  77.     Lister_Path = Strip(RESULT,"B",'"')
  78.  
  79.     Do i=1 to Lister_NumSelEnt
  80.         lister query Lister_Handle firstsel
  81.         Temp_Name = Strip(RESULT,"B",'"')
  82.         lister select Lister_Handle Temp_Name 0
  83.         Temp_Path = Lister_Path || Temp_Name
  84.         Address RXTRACKER Load Temp_Path;Address RXTRACKER Play
  85.  
  86.         If Lister_NumSelEnt - i > 0 Then Do
  87.             If Quit_After = "YES" Then
  88.                 dopus request '"Playing module ' i ' of ' Lister_NumSelEnt ':' X2C(0A) Temp_Name '" Next|Leave Playing|Stop'
  89.             Else
  90.                 dopus request '"Playing module ' i ' of ' Lister_NumSelEnt ':' X2C(0A) Temp_Name '" Next|Leave Playing'
  91.             IF RC = "0" THEN BreakIt = "YES"
  92.             IF RC = "2" THEN Do
  93.                 BreakIt = "YES"
  94.                 Quit_After = "NO"
  95.                 END
  96.             End
  97.  
  98.         Else Do
  99.             If Quit_After = "YES" Then
  100.                 dopus request '"Playing module ' i ' of ' Lister_NumSelEnt ':' X2C(0A) Temp_Name '" Leave Playing|Stop'
  101.             Else
  102.                 dopus request '"Playing module ' i ' of ' Lister_NumSelEnt ':' X2C(0A) Temp_Name '" Leave Playing'
  103.             IF RC = "1" Then Quit_After = "NO"
  104.             End
  105.  
  106.         IF BreakIt = "YES" THEN BREAK
  107.         END
  108.     End
  109.  
  110. ELSE Do
  111.     Address RXTRACKER Load FilePath;Address RXTRACKER Play
  112.     If Quit_After = "YES" Then
  113.         dopus request '"Playing module:' X2C(0A) FilePath'" Leave Playing|Stop'
  114.     Else
  115.         dopus request '"Playing module:' X2C(0A) FilePath'" Leave Playing'
  116.     IF RC ~= "0" THEN Quit_After = "NO"
  117.     End
  118.  
  119. /*-- Restore the Lister for normal use --------------------------------------*/
  120. syntax:;ioerr:                /* In case of error, jump here */
  121. END_PART_2:
  122. If FilePath = "" Then Do
  123.     lister refresh Lister_Handle
  124.     lister set Lister_Handle busy 0
  125.     END
  126. END_PART:
  127. If Quit_After = "YES" Then Address RXTRACKER QUIT
  128.  
  129. EXIT
  130.